﻿
using System.Windows;
using System.Windows.Controls;
using GSSoftSL.ViewModel.HocVienVM;
using GSSoftSL.Web.Models;
using GSSoftSL.Web.Services;

namespace GSSoftSL.Views.HocVienView
{
    /// <summary>
    /// Description for HocVienSearchView.
    /// </summary>
    public partial class HocVienSearchView : ChildWindow
    {
        //private GSSoftContext _dc;

        public HocVien SelectedHocVien { get; set; }

        /// <summary>
        /// Initializes a new instance of the HocVienSearchView class.
        /// </summary>
        public HocVienSearchView()//GSSoftContext context)
        {
            InitializeComponent();
            //this.DataContext = new HocVienSearchProxy();
            //_dc = context;
            this.DataContext = new HocVienSearchViewModel();//_dc);
        }

        private void ChildWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //e.Cancel = true;
            //this.Visibility = Visibility.Collapsed;
            //SelectedHocVien = null;
        }

        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            SelectedHocVien = dataGrid.SelectedItem as HocVien;
            //this.Visibility = Visibility.Collapsed;
        }

        private void btnExit_Click(object sender, RoutedEventArgs e)
        {
            //this.Visibility = Visibility.Collapsed;
            SelectedHocVien = null;
            this.Close();
        }

        private void btnSelect_Click(object sender, RoutedEventArgs e)
        {
            SelectedHocVien = dataGrid.SelectedItem as HocVien;
            this.Close();
        }

    }
}